diff options
| author | Adam Soltys <[email protected]> | 2022-10-31 23:15:37 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2022-10-31 23:15:37 -0700 |
| commit | 363f1b23d00ec8ec1e4d6b66afa2b28f87e45902 (patch) | |
| tree | 2685855ef900a15d8b1f1e386e59199dc0e2e4c9 /src/routes/invoice/[id]/+layout.server.js | |
| parent | 61fb616ff75b6c117b153b28fca937a0eafe26be (diff) | |
| download | coinos-ui-363f1b23d00ec8ec1e4d6b66afa2b28f87e45902.tar.gz coinos-ui-363f1b23d00ec8ec1e4d6b66afa2b28f87e45902.zip | |
server side qr
Diffstat (limited to 'src/routes/invoice/[id]/+layout.server.js')
| -rw-r--r-- | src/routes/invoice/[id]/+layout.server.js | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/routes/invoice/[id]/+layout.server.js b/src/routes/invoice/[id]/+layout.server.js index e123c7d7..690deda0 100644 --- a/src/routes/invoice/[id]/+layout.server.js +++ b/src/routes/invoice/[id]/+layout.server.js @@ -1,6 +1,14 @@ +import Qr from 'qrcode-svg'; import { get } from '$lib/utils'; export async function load({ params }) { let { id } = params; - return { id, invoice: await get(`/invoice?uuid=${id}`) }; + let invoice = await get(`/invoice?uuid=${id}`); + let svg = new Qr({ + content: invoice.text, + join: true, + container: 'svg-viewbox' + }).svg(); + + return { id, invoice, svg }; } |
